package com.es.servlet; /**
 * 描述:
 * es-jsp-
 *
 * @author Derek
 * 创建时间：2022-04-26 11:36
 */

import com.es.bean.Student;
import com.es.service.StudentService;
import com.es.service.impl.StudentServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "ToUpdateServlet", value = "/toUpdate")
public class ToUpdateServlet extends HttpServlet {

    StudentService service = new StudentServiceImpl();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //先把这条数据查询出来？
        int id = Integer.parseInt(request.getParameter("id"));
        //
        Student student = service.get(id);
        //
        request.setAttribute("student", student);
        //请求分派到 update。jsp
        request.getRequestDispatcher("update.jsp").forward(request,response);
    }

}
